// slices/routeSlice.js
import { createSlice } from "@reduxjs/toolkit";

const initialState = {
  userInfo: [],
};

const headerSlice = createSlice({
  name: "header",
  initialState,
  reducers: {
    setUserInfo: (state, action) => {
      console.log("Setting user info in Redux:", action.payload); // 调试：打印设置的用户信息
      state.userInfo = action.payload;
    },
  },
});

export const { setUserInfo } = headerSlice.actions;
export default headerSlice.reducer;
